<?php
namespace core\database\driver;

use core\database\IDatabase;
use core\Register;

class MySQLi implements IDatabase
{
	/**
	 * @var false|\mysqli
	 */
	protected $link;

	function connect($host, $user, $pass, $dbname, $charset = 'utf8')
	{
		if (is_null($this->link)) {
			$db = mysqli_connect($host, $user, $pass, $dbname);
			$db->set_charset($charset);
		}
		$this->link = $db;
	}

	function query($sql)
	{
		return mysqli_query($this->link, $sql);
	}

	function close()
	{
		mysqli_close($this->link);
	}

	private function __clone()
	{
		// TODO: Implement __clone() method.
	}
}
